package com.okq.entity;

import com.okq.entity.base.DataEntity;
import org.apache.commons.lang.StringUtils;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * 描述 : 生产表实体类
 * 作者 : zdl
 * 日期 : 2017/6/28 9:57
 */
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "tb_production")
public class Production extends DataEntity implements Serializable {
    private static final long serialVersionUID = 980069080955160253L;
    /**
     * 产品批次
     */
    @Column(name = "batch", length = 40)
    private String batch;
    /**
     * 产品类型 1：农残 2：土肥 3：土壤墒情 4：农业气象站 5：...
     */
    @Column(name = "productType")
    private Integer productType;
    /**
     * 生产开始时间
     */
    @Column(name = "startTime")
    private String startTime;
    /**
     * 生产结束时间
     */
    @Column(name = "entTime")
    private String entTime;
    /**
     * 生产总数
     */
    @Column(name = "number")
    private Integer number;
    /**
     * 生产负责人Id
     */
    @Column(name = "chargeId", length = 40)
    private String chargeId;
    /**
     * 合格数量
     */
    @Column(name = "qualified")
    private Integer qualified;
    /**
     * 生产状态 0：未开始 1：进行中 2：已完成 3：已质检 4：已入库
     */
    @Column(name = "state")
    private Integer state;
    /**
     * 备注
     */
    @Column(name = "remark")
    private String remark;

    public String getBatch() {
        return batch;
    }

    public void setBatch(String batch) {
        this.batch = batch;
    }

    public Integer getProductType() {
        return productType;
    }

    public void setProductType(Integer productType) {
        this.productType = productType;
    }

    public String getStartTime() {
        if (StringUtils.isNotBlank(startTime)) {
            startTime = startTime.substring(0, (startTime.lastIndexOf(".")));
        }
        return startTime;
    }

    public void setStartTime(String startTime) {
        if (StringUtils.isNotBlank(startTime)) {
            startTime = startTime + ".0";
        }
        this.startTime = startTime;
    }

    public String getEntTime() {
        if (StringUtils.isNotBlank(entTime)) {
            entTime = entTime.substring(0, (entTime.lastIndexOf(".")));
        }
        return entTime;
    }

    public void setEntTime(String entTime) {
        if (StringUtils.isNotBlank(entTime)) {
            entTime = entTime + ".0";
        }
        this.entTime = entTime;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public String getChargeId() {
        return chargeId;
    }

    public void setChargeId(String chargeId) {
        this.chargeId = chargeId;
    }

    public Integer getQualified() {
        return qualified;
    }

    public void setQualified(Integer qualified) {
        this.qualified = qualified;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
